/*
 * Created on 7 avr. 2007
 */
package fr.mywiki.business.utils;

/**
 * Contains several methods dealing with Java arrays.
 */
public class ArrayUtils {
	private ArrayUtils() {
	}

	/**
	 * Returns the position of the minimum of a array of integers. Only positive
	 * values are allowed.
	 * 
	 * @param tab
	 *          a array of integers
	 * @return a integer
	 */
	protected static int getMinimumPositive(int[] tab) {
		int minIndex = -1;
		int min = Integer.MAX_VALUE;

		for (int i = 0; i < tab.length; i++)
			if (tab[i] < min && tab[i] > -1) {
				min = tab[i];
				minIndex = i;
			}
		return minIndex;
	}
}
